package cn.gson.crm.model.pojos;

import javax.persistence.*;
import java.util.Objects;

@Entity
@Table(name = "Return_details", schema = "CRM", catalog = "")
public class ReturnDetails {
    private long rdetailsDi;
    private String rProductname;
    private Long rPrice;
    private String rUompany;
    private Integer rNumber;
    private String rSize;
    private String rColor;
    private ReturnGoods returnGoods;
    @ManyToOne
    @JoinColumn(name = "RETURN_ID", referencedColumnName = "RETURN_ID")
    public ReturnGoods getReturnGoods() {
        return returnGoods;
    }

    public void setReturnGoods(ReturnGoods returnGoods) {
        this.returnGoods = returnGoods;
    }

    @Id
    @Column(name = "rdetails_di")
    @GeneratedValue(generator = "seq",strategy = GenerationType.SEQUENCE)
    //定义一个序列生成器
    @SequenceGenerator(name = "seq",sequenceName = "crm",
            initialValue = 1,allocationSize = 1)
    public long getRdetailsDi() {
        return rdetailsDi;
    }

    public void setRdetailsDi(long rdetailsDi) {
        this.rdetailsDi = rdetailsDi;
    }

    @Basic
    @Column(name = "r_productname")
    public String getrProductname() {
        return rProductname;
    }

    public void setrProductname(String rProductname) {
        this.rProductname = rProductname;
    }

    @Basic
    @Column(name = "r_price")
    public Long getrPrice() {
        return rPrice;
    }

    public void setrPrice(Long rPrice) {
        this.rPrice = rPrice;
    }

    @Basic
    @Column(name = "r_uompany")
    public String getrUompany() {
        return rUompany;
    }

    public void setrUompany(String rUompany) {
        this.rUompany = rUompany;
    }

    @Basic
    @Column(name = "r_number")
    public Integer getrNumber() {
        return rNumber;
    }

    public void setrNumber(Integer rNumber) {
        this.rNumber = rNumber;
    }

    @Basic
    @Column(name = "r_size")
    public String getrSize() {
        return rSize;
    }

    public void setrSize(String rSize) {
        this.rSize = rSize;
    }

    @Basic
    @Column(name = "r_color")
    public String getrColor() {
        return rColor;
    }

    public void setrColor(String rColor) {
        this.rColor = rColor;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        ReturnDetails that = (ReturnDetails) o;
        return rdetailsDi == that.rdetailsDi &&
                Objects.equals(rProductname, that.rProductname) &&
                Objects.equals(rPrice, that.rPrice) &&
                Objects.equals(rUompany, that.rUompany) &&
                Objects.equals(rNumber, that.rNumber) &&
                Objects.equals(rSize, that.rSize) &&
                Objects.equals(rColor, that.rColor);
    }

    @Override
    public int hashCode() {
        return Objects.hash(rdetailsDi, rProductname, rPrice, rUompany, rNumber, rSize, rColor);
    }
}
